package com.libra.rabbitmq.hello.serviceImp;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.handler.annotation.Payload;

import com.alibaba.fastjson.JSON;
import com.libra.model.mq.Teacher;
import com.libra.rabbitmq.config.QueueConstants;

/**
 * 消息消费者1
 * @author zhuzhe
 * @date 2018/5/25 17:32
 * @email 1529949535@qq.com
 */
@Configuration
public class ConsumerOneServiceImpl {

	 /**
     * logger instance
     */
    static Logger logger = LoggerFactory.getLogger(ConsumerOneServiceImpl.class);

    @RabbitListener(queues = QueueConstants.MESSAGE_QUEUE_NAME)//@RabbitHandler
    public void handler(@Payload Teacher teacher) {
        logger.info("A消费内容：{}", JSON.toJSONString(teacher));
    }
}
